<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich" %>
<% String contextRoot = request.getContextPath(); %>
<f:loadBundle basename="properties.messages" var="msg" />
<f:view>
<!doctype html>
<html>
<head>
	<%@ include file="include/meta.jsp" %>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
	<title>SISDEP : Sistema de Informaci<h:outputText value="#{msg.tilde_o}" />n de Espacio P<h:outputText value="#{msg.tilde_u}" />blico</title>
	<meta name="description" content="">
	<meta name="author" content="">
	<link rel="stylesheet" href="<%=contextRoot%>/css/validationEngine.jquery.css" type="text/css">
	<link rel="stylesheet" href="<%=contextRoot%>/css/template.css" type="text/css">
	<link rel="stylesheet" href="<%=contextRoot%>/css/normalize.css">
	<link rel="stylesheet" href="<%=contextRoot%>/css/uniform.css"> <!-- estilos formularios -->
	<link rel="stylesheet" href="<%=contextRoot%>/css/cuerpo.css">	
	<link rel="stylesheet" href="<%=contextRoot%>/css/richCustom.css">
</head>
<body>
	<div id="marco"> <!--inicio contenedor -->
		<div class="arriba-cuerpo"></div> <!-- Burrada pa ver borde redondo en IE -->
		<div class="cuerpo">
			<img src="<%=contextRoot%>/images/logos.png" />
			<div class="clear"></div>
			<!-- Menu y Usuario init() -->
			<%@ include file="include/menuUsuario.jsp"%>
			<!-- Menu y Usuario end() -->
			<div class="clear"></div>
			<!-- Formulario -->
			<div id="buscador">
				<h2>Gesti<h:outputText value="#{msg.tilde_o}"/>n de Sensibilizaci<h:outputText value="#{msg.tilde_o}"/>n: <h:outputText value="#{'NUEVO'}" /></h2>
				<h:form id="createSensibilizacionForm">
					<span class="left">
					<label>Tipo de Sensibilizaci<h:outputText value="#{msg.tilde_o}"/>n<span class="asterisco">*</span></label>
							<h:selectOneMenu id="idSensibilizacionTipo" styleClass="validate[required]" value="#{sensibilizacionController.sensibilizacion.idSensibilizacionTipoStr}">
								<f:selectItem itemLabel="Seleccione..." itemValue=""/>
								<f:selectItems value="#{masterListCache.sensitizationTypeList}"/>
							</h:selectOneMenu>
					</span>
					<span class="left" style="margin-left: 10%;">
							<label><h:outputText value="#{msg.tilde_A}"/>rea de Sensibilizaci<h:outputText value="#{msg.tilde_o}"/>n<span class="asterisco">*</span></label>
							<h:selectOneMenu id="idArea" styleClass="validate[required]" value="#{sensibilizacionController.sensibilizacion.idAreaStr}">
								<f:selectItem itemLabel="Seleccione..." itemValue=""/>
								<f:selectItems value="#{masterListCache.SDEPAreaTypeList}"/>
							</h:selectOneMenu>
					</span>
					<span class="left" style="margin-left: 10%;">
					<label>C<h:outputText value="#{msg.tilde_o}"/>digo <span class="asterisco">*</span></label>
						<h:inputText id="codigo" size="10" maxlength="7" disabled="true" styleClass="validate[required,custom[onlyNumberSp]]"
									value="#{sensibilizacionController.sensibilizacion.codigo}" />
					</span>
					<div class="clear"></div>
					<br/>
					<span class="left" >
					<label>Fecha <span class="asterisco">*</span></label>
						<h:inputText id="fechaSen" styleClass="validate[required,custom[date]] fechaSen" size="10" maxlength="10"
								value="#{sensibilizacionController.sensibilizacion.fecha}">
							<f:convertDateTime pattern="dd/MM/yyyy"/>
						</h:inputText>
					</span>

					<span class="left" style="margin-left:10%">
						<label>Direcci<h:outputText value="#{msg.tilde_o}"/>n de Sensibilizaci<h:outputText value="#{msg.tilde_o}"/>n  <span class="asterisco">*</span></label>	
						<h:inputText id="direccionResidencia" size="50" maxlength="60" styleClass="validate[required]"
									value="#{sensibilizacionController.sensibilizacion.direccionResidencia}" />     
							
						<a4j:commandButton id="checkAddressButton"
										 styleClass="botonsmall"
						                 type="submit" 
						                 value="Verificar..." ajaxSingle="true" 
						                 ondblclick="return false;" reRender="checkAddressPanel"
				                         action="#{sensibilizacionController.checkAddress}" >
				                         <a4j:actionparam name="addressParam" value="document.getElementById('createSensibilizacionForm:direccionResidencia').value" 
					                                          assignTo="#{sensibilizacionController.sensibilizacion.direccionResidencia}" noEscape="true" />
						</a4j:commandButton>
					</span>

					<div class="clear" style="margin-left: 400px;"></div>

					<span class="left" style="margin-left:0px">
					<label>
						<a4j:outputPanel id="checkAddressPanel" layout="block" >
							<h:panelGrid columns="1" style="text-align: left;" styleClass="tablapaginacion" >
							<h:outputText value="Barrio: #{sensibilizacionController.sensibilizacion.codigoBarrio}-#{sensibilizacionController.sensibilizacion.barrio}" />
							<h:outputText value="Comuna: #{sensibilizacionController.sensibilizacion.codigoComuna}-#{sensibilizacionController.sensibilizacion.comuna}" />
	                        </h:panelGrid>
                        </a4j:outputPanel>
                    </label>
					</span>

					<div class="clear" style="margin-left: 400px;"></div>

					<span class="left" style="margin-left: 0%;">
					<label>Lugar <span class="asterisco">*</span></label>
						<h:inputText id="lugar" size="60" maxlength="128" styleClass="validate[required]"
									value="#{sensibilizacionController.sensibilizacion.lugar}" />
					</span>
					<span class="left" style="margin-left: 10%;">
					<label>Tel<h:outputText value="#{msg.tilde_e}"/>fono <span class="asterisco">*</span></label>
						<h:inputText id="telefono" size="15" maxlength="10" styleClass="validate[required,custom[phone]]"
									value="#{sensibilizacionController.sensibilizacion.telefono}" />
					</span>
					<div class="clear"></div> <br/>
					<span class="left" >
					<label>Establecimiento <span class="asterisco">*</span></label>
						<h:inputText id="establecimiento" size="30" maxlength="128" styleClass="validate[required]"
									value="#{sensibilizacionController.sensibilizacion.establecimiento}" />
					</span>
					<span class="left" style="margin-left:10%;">
						<label>Estado <span class="asterisco">*</span></label>
							<h:selectOneMenu id="estado" styleClass="validate[required]"
												value="#{sensibilizacionController.sensibilizacion.estado}">
                                <f:selectItem itemLabel="Seleccione..." itemValue=""/>
                                <f:selectItem itemLabel="Vigente" itemValue="VIGENTE"/>
                                <f:selectItem itemLabel="Nueva" itemValue="NUEVA"/>
                                <f:selectItem itemLabel="Pendiente" itemValue="PENDIENTE"/>
                                <f:selectItem itemLabel="Cancelada" itemValue="CANCELADA"/>
                                <f:selectItem itemLabel="Terminada" itemValue="TERMINADA"/>
                            </h:selectOneMenu>
					</span>
					<div class="clear"></div>
										<br/>
					(<span class="asterisco"> * </span>) : Campo Obligatorio
					<div class="clear"></div>
					<span class="left inline">
						<h:commandButton id="createSensibilizacionButton"
										 styleClass="botonsmall"
										 type="submit" 
										 value="Guardar" 
										 ondblclick="return false;" 
										 action="#{sensibilizacionController.create}" >
						</h:commandButton>
					</span>
				</h:form>
				<span class="left inline">
					<h:form id="cleanSensibilizacionForm">
						<h:commandButton id="cleanSensibilizacionButton"
										 styleClass="botonsmall"
										 type="submit" 
										 value="Limpiar" 
										 ondblclick="return false;" 
										 action="#{sensibilizacionController.createSensibilizacion}" >
						</h:commandButton>		
					</h:form>
				</span>
			</div>
			<!-- Fin formulario div buscador !!! -->
			<div class="clear"></div>
			<div>
			    <h:form id="cancelSensibilizacionForm">
					<h:commandButton id="cancelCreateSensibilizacionButton"
									 styleClass="botonsmall" 
									 type="submit" 
									 value="Cancelar" 
									 ondblclick="return false;" 
									 action="#{sensibilizacionController.cancelSensibilizacion}" >
					</h:commandButton>
				</h:form>
			</div>
			<div class="clear"></div>
		</div><!-- Fin DIV CUERPO -->
		<div class="abajo-cuerpo"></div>
		<!-- Burrada pa ver borde redondo en IE -->
	</div>
	<!-- Fin contenedor -->
	<div class="footer"></div>
	<script src="<%=contextRoot%>/js/jquery/lib/jquery-1.7.2.min.js"></script>
	<script src="<%=contextRoot%>/js/script.js"></script>
	<script src="<%=contextRoot%>/js/jquery.maskedinput-1.3.js"	type="text/javascript"></script>
	<script src="<%=contextRoot%>/js/jquery/lib/jquery.uniform.min.js"></script>
	<!-- formularios -->
	<script	src="<%=contextRoot%>/js/jquery/lib/jquery.validationEngine-es.js" type="text/javascript" charset="utf-8"></script>
	<script	src="<%=contextRoot%>/js/jquery/lib/jquery.validationEngine.js"	type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript" charset="utf-8">
		jQ(document).ready(function() {
			jQ("input, select, input:checkbox, input:radio, input:file").uniform();
			jQ("#createSensibilizacionForm").validationEngine('attach');
			jQ("#createSensibilizacionForm").bind("jqv.form.result", function(event, errorFound) {
				if (!errorFound)
					displayLoadingImage();
				});
			jQ(".fechaSen").mask("99/99/9999");
		});
	</script>
	<%@ include file="include/validationStatus.jsp"%>
	<%@ include file="include/modalMessageWindow.jsp"%>
</body>
</html>
</f:view>